<%@ page import="java.util.List" %>
<%@ page import="org.omg.IOP.Encoding" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="service.*" %>
<%@ page import="model.*" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/9
  Time: 9:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    User client=(User) session.getAttribute("curUser");
    RemarkService remarkService=new RemarkService();
    UserService userService=new UserService();
    CommunityService communityService=new CommunityService();
    String cNum="";
    if (request.getParameter("cNumByPara")!=null) {
        cNum=request.getParameter("cNumByPara");
        session.setAttribute("cNum",cNum);
    }else cNum=(String) session.getAttribute("cNum");
    List<Remark> remarks=remarkService.getRMByComm(cNum);
    List<User> users=communityService.getUserByComm(cNum);
    ActivityService activityService=new ActivityService();
    Community community=communityService.getCommByID(cNum);
    List<Activity> activities=activityService.getAcByComm(cNum);
    String manageIden=communityService.getIdenByNum(client.getStuNum(),cNum);

    MessageService messageService=new MessageService();
    String stuNum = client.getStuNum();
    List<Message> messages = messageService.getMessagesNotRead(stuNum);
%>
<!doctype html>
<html lang="en">

<head>
    <title>社团部落-管理社团</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <!-- VENDOR CSS -->
    <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/vendor/linearicons/style.css">
    <link rel="stylesheet" href="assets/vendor/chartist/css/chartist-custom.css">
    <!-- MAIN CSS -->
    <link rel="stylesheet" href="assets/css/main.css">

    <!-- GOOGLE FONTS -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700" rel="stylesheet">

    <link href= "assets/css/communityManager.css" type="text/css" rel="stylesheet" />
    <!-- ICONS -->
    <link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
    <link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon.png">
</head>

<body>
<!-- WRAPPER -->
<div id="wrapper">
    <!-- NAVBAR -->
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="brand">
            <a href="homepage.jsp"><img src="assets/img/logo-dark.png" alt="Klorofil Logo" class="img-responsive logo"></a>
        </div>

        <div class="container-fluid">
            <div class="navbar-btn">
                <button type="button" class="btn-toggle-fullwidth"><i class="lnr lnr-arrow-left-circle"></i></button>
            </div>

            <form class="navbar-form navbar-left" action="Search" method="post">
                <div class="input-group">
                    <input type="text" value="" name="search" class="form-control" placeholder="请输入要查询的内容">
                    <span class="input-group-btn">
                                <button type="submit" class="btn btn-primary">搜索</button></span>
                </div>
            </form>

            <div class="navbar-btn navbar-btn-right">
                <a class="btn btn-success update-pro" href="login.do?action=out" title="" target=""><i class="fa fa-rocket"></i> <span>退出登录</span></a>
            </div>

            <div id="navbar-menu">
                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle icon-menu" data-toggle="dropdown">
                            <i class="lnr lnr-alarm"></i>
                            <span class="badge bg-danger" id="NoticeCount"><%=messageService.getCount(stuNum)%></span></a>
                        <ul class="dropdown-menu notifications" style="overflow-y:auto;width:320px; max-height:400px;">
                            <div class="panel-heading b-light bg-light">
                                <strong>通知</strong>
                            </div>
                            <%
                                for(int i = 0; i < messages.size(); i++){%>
                            <li id="<%=i%>" class="media list-group-item" style="display: block" data-stopPropagation="true">
                                        <span class="pull-left thumb-sm text-center">
                                            <a href="<%=messages.get(i).getmSrc()%>" onclick="setNoticeReaded('<%=i%>','<%=messages.get(i).getmNum()%>','0')">

                                                <i class="fa fa-check fa-2x text-success"></i>
                                            </a>
                                        </span>
                                <span class="media-body m-b-none"><%=messages.get(i).getmContent()%>
                                            <br>
                                            <small class="text-muted"><%=messages.get(i).getmTime()%></small></span>
                            </li>
                            <%}
                            %>
                            <div class="panel-footer text-sm">
                                <a href="javascript:void(0)" onclick="setAllNoticeReaded('1','<%=stuNum%>')">全部标记为已读</a>
                            </div>
                        </ul>
                    </li>



                    <li class="dropdown">
                        <a href="UserInfo.jsp">
                            <img src="<%=client.getStuSrc()%>" class="img-circle" alt="Avatar">
                            <span><%=client.getuName()%></span>
                        </a>

                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- END NAVBAR -->

    <!-- LEFT SIDEBAR -->
    <div id="sidebar-nav" class="sidebar">
        <div class="sidebar-scroll">
            <nav>
                <ul class="nav">
                    <li>
                        <a href="homepage.jsp" class="">
                            <i class="lnr lnr-home"></i>
                            <span>主页</span></a>
                    </li>

                    <li>
                        <a href="Community.jsp" class="active">
                            <i class="lnr lnr-location"></i>
                            <span>我的社团</span></a>
                    </li>

                    <li>
                        <a href="UserInfo.jsp" class="">
                            <i class="lnr lnr-cog"></i>
                            <span>个人信息</span></a>
                    </li>

                    <li>
                        <a href="CommunityList.jsp" class="">
                            <i class="lnr lnr-dice"></i>
                            <span>社团列表</span></a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
    <!-- END LEFT SIDEBAR -->

    <!-- MAIN -->
    <div class="main">
        <!-- MAIN CONTENT -->
        <div class="main-content">
            <div class="container-fluid">
                <!--

                    描述：社团详情
                -->
                <h2 class="page-title"><%=community.getcName()%></h2>
                <!--社团简介-->
                <div class="panel panel-headline">
                    <div class="panel-body">
                        <h3>简介</h3>
                        <form action="Community" method="post">
                            <input type="hidden" name="type" value="manage">
                            <div class="newact">
                                <span id="alter" class="trans" onmouseover="this.style.color='#3287B2';" onmouseout="this.style.color='';"><i class="lnr lnr-pencil"></i>&nbsp修改简介</span>

                                <button type="submit" name="reviseSyn" value="<%=community.getcNum()%>" id="alterConfirm" class="btn btn-success" style="display:none">确认修改</button>
                            </div>
                            <hr>
                            <textarea id="intro" class="form-control intro"  name="getSyn" readonly="readonly" style="height:120px;"><%=community.getSyn()%>
                            </textarea>
                        </form>
                    </div>
                </div>
                <!--

                    描述：活动列表
               -->
                <div class="panel">
                    <div class="panel-heading" style="padding-bottom: 0;">
                        <h2 class="panel-title">活动</h2>
                        <div class="newact">
                            <a href="createAct.jsp?cNum=<%=cNum%>">发布活动</a>
                        </div>
                    </div>
                    <div class="panel-body">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>名称</th>
                                <th>日期</th>
                                <th ></th>
                            </tr>
                            </thead>

                            <form action="Activity">
                                <input type="hidden" name="type" value="manage">
                                <tbody>
                                <%
                                    for (int i=0;i<activities.size();i++) {
                                        Activity activity=activities.get(i);


                                %>
                                <tr>
                                    <td><a href="Activity?aNum=<%=activity.getaNum()%>"><%=activity.getaTitle()%></a></td>
                                    <td><%=activity.getaDate()%></td>
                                    <td style="width:100px;">
												  <span id="activityDel<%=i%>" class="trans">删除
												  </span>
                                    </td>
                                </tr>

                                <tr id="tr-activityDel<%=i%>" style="display:none;">
                                    <td colspan="2" style="color:black">确定删除活动吗？</td>

                                    <td style="text-align: left;">
                                        <button type="submit" name="aNum" class="btn-agree" value="<%=activity.getaNum()%>" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                            <span class="glyphicon glyphicon-ok"></span>
                                        </button>
                                        <span id="activityDel-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                    </td>

                                </tr>
                                <%
                                    }
                                %>
                                </tbody>
                            </form>
                        </table>
                    </div>
                </div>

                <div class="row">
                    <!--

                    描述：成员列表
                -->
                    <div class="col-md-6">
                        <div class="panel">
                            <div class="panel-heading">
                                <h2 class="panel-title">成员</h2>
                            </div>
                            <div class="panel-body">
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <th style="width:60px;">用户</th>
                                            <th style="width:170px;"></th>
                                            <th style="width:90px;">姓名</th>
                                            <th style="width:70px;">职务</th>
                                            <th style="width:140px;"></th>
                                        </tr>
                                        </thead>

                                        <form action="Community">
                                            <input type="hidden" name="type" value="manage">
                                            <tbody  id="tbody-member">
                                            <%
                                                for (int i=0;i<users.size();i++) {
                                                    User user=users.get(i);
                                            %>

                                                <%
                                                    int state=communityService.getUStateByNum(user.getStuNum(),cNum);
                                                    if (state==1){
                                                        String iden=communityService.getIdenByNum(user.getStuNum(),cNum);
                                                        if (iden.equals("1")){
                                                            iden="社长";
                                                        }else if (iden.equals("2")) iden="管理员";
                                                        else if (iden.equals("3")) iden="成员";
                                                %>

                                            <tr>
                                                <td><img src="<%=user.getStuSrc()%>" class="img-circle" alt="Avatar" style="width: 35px;height:35px"></td>
                                                <td><a href=User?stuNum=<%=user.getStuNum()%>><%=user.getuName()%></a></td>
                                                <td><%=user.getStuName()%></td>
                                                <td><%=iden%></td>
                                                <%
                                                    if (iden.equals("社长")) {
                                                %>
                                                <td style="width:120px;"></td>
                                            </tr>
                                            <%
                                                }else if (iden.equals("管理员")){
                                                        if (manageIden.equals("1")) {
                                            %>
                                            <td style="width:120px;">
												  <span id="grant<%=i%>" class="btn-agree" style="padding-right:15px">
												     交接</span>
                                                <span id="revoke<%=i%>" class="trans">撤职
												  </span>
                                            </td>
                                            <%
                                                } else {
                                            %>
                                            <td style="width:120px;"></td>
                                            <%
                                                }
                                            %>
                                            </tr>

                                            <!-- 社长交接 -->
                                            <tr id="tr-grant<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">确定将社长职位交予<%=user.getuName()%>吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="takeover" value="<%=community.getcNum()%>&<%=user.getStuNum()%>&<%=client.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="grant-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <!-- END 社长交接 -->

                                            <!-- 收回管理员权限 -->
                                            <tr id="tr-revoke<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">确定收回<%=user.getuName()%>的管理权限吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="demote" value="<%=community.getcNum()%>&<%=user.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="revoke-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <!-- END 收回管理员权限 -->
                                            <!-- END 管理员 -->


                                            <%
                                                }
                                                else if (iden.equals("成员")) {
                                            %>
                                                <td>
                                                    <%
                                                        if (manageIden.equals("1")) {
                                                    %>
                                                    <span id="manage<%=i%>" class="btn-agree" style="padding-right:15px">授权
												  </span>
                                                    <%
                                                        }else if (manageIden.equals("2")) {
                                                    %>
                                                    <span style="padding-right:15px"></span>
                                                    <%
                                                        }
                                                    %>
                                                    <span id="remove<%=i%>" class="trans" >移出
												  </span>
                                                </td>
                                            </tr>
                                            <!-- 授予管理员 -->
                                            <tr id="tr-manage<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">确定授予"<%=user.getuName()%>"管理员吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="promote" value="<%=community.getcNum()%>&<%=user.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="manage-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <!-- END 授予管理员 -->

                                            <!-- 移出社员 -->
                                            <tr id="tr-remove<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">确定将"<%=user.getuName()%>"移出社团吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="memberDel" value="<%=community.getcNum()%>&<%=user.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="remove-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <%
                                                }
                                            %>
                                            <!-- END 移出社员 -->
                                            <!-- END 普通成员 -->
                                                    <%
                                                    }else {
                                                %>
                                            <tr style="color:red;">
                                                <td><img src="<%=user.getStuSrc()%>" class="img-circle" alt="Avatar" style="width: 35px;height:35px"></td>
                                                <td><a href=User?stuNum=<%=user.getStuNum()%>><%=user.getuName()%></a></td>
                                                <td><%=user.getStuName()%></td>
                                                <td>待审核</td>
                                                <td>
												  <span id="agree<%=i%>" class="btn-agree" style="padding-right:15px">同意
												  </span>
                                                    <span id="refuse<%=i%>" class="trans">拒绝
												  </span>
                                                </td>
                                            </tr>
                                            <!-- 同意申请 -->
                                            <tr id="tr-agree<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">同意"<%=user.getuName()%>"加入社团吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="agree" value="<%=community.getcNum()%>&<%=user.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="agree-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <!-- END 同意申请 -->

                                            <!-- 拒绝申请 -->
                                            <tr id="tr-refuse<%=i%>" style="display:none;">
                                                <td colspan="4" style="color:black">拒绝"<%=user.getuName()%>"加入社团吗？</td>

                                                <td style="text-align: right;">
                                                    <button type="submit" name="memberDel" value="<%=community.getcNum()%>&<%=user.getStuNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                        <span class="glyphicon glyphicon-ok"></span>
                                                    </button>
                                                    <span id="refuse-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                                </td>

                                            </tr>
                                            <!-- END 拒绝申请 -->
                                            <!-- END 待审核 -->
                                                <%
                                                        }
                                                }
                                            %>
                                            </tbody>
                                        </form>

                                    </table>
                            </div>
                        </div>
                    </div>
                    <!--

                        描述：留言列表
                    -->
                    <div class="col-md-6">
                        <div class="panel">
                            <div class="panel-heading">
                                <h1 class="panel-title">留言</h1>
                            </div>
                            <div class="panel-body">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th style="width:60px;">用户</th>
                                        <th></th>
                                        <th style="width:170px;">留言</th>
                                        <th style="width:100px;">时间</th>
                                        <td style="width:90px;"></td>
                                    </tr>
                                    </thead>

                                    <form action="Remark">
                                        <input type="hidden" name="type" value="manage">
                                        <tbody>
                                        <%
                                            for (int i=0;i<remarks.size();i++) {
                                                Remark remark=remarks.get(i);
                                        %>

                                        <tr>
                                            <%
                                                User remarker=userService.getUserByID(remark.getStuNum());
                                            %>
                                            <td><img src="<%=remarker.getStuSrc()%>" class="img-circle" alt="Avatar" style="width: 35px;height:35px"></td>
                                            <td><a href="Remark?rNum=<%=remark.getrNum()%>&type=normal"><%=remarker.getuName()%></a></td>
                                            <td><%=remark.getrContent()%></td>
                                            <td><%=remark.getrDate()%></td>
                                            <td style="width:100px;">
												  <span id="messageDel<%=i%>" class="trans">删除
												  </span>
                                            </td>
                                        </tr>

                                        <!-- 删除留言 -->
                                        <tr id="tr-messageDel<%=i%>" style="display:none;">
                                            <td colspan="4" style="color:black">确定删除留言吗？</td>

                                            <td>
                                                <input type="hidden" name="type" value="remarkDel">
                                                <button type="submit" name="remarkDel" value="<%=remark.getrNum()%>" class="btn-agree" onmouseover="this.style.color='#006600';" onmouseout="this.style.color='';">
                                                    <span class="glyphicon glyphicon-ok"></span>
                                                </button>
                                                <span id="messageDel-cancel<%=i%>" class="btn-red glyphicon glyphicon-remove"></span>
                                            </td>

                                        </tr>
                                        <!-- END 删除留言 -->

                                        <%
                                            }
                                        %>
                                        </tbody>
                                    </form>
                                </table>
                                <!--

                                    描述：写留言
                                -->

                            </div>
                        </div>

                    </div>
                </div>

            </div>
        </div>
        <!-- END MAIN CONTENT -->
    </div>
    <!-- END MAIN -->
    <!-- END WRAPPER -->

    <!-- Javascript -->
    <script src="assets/vendor/jquery/jquery.min.js"></script>
    <script src="assets/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="assets/vendor/jquery-slimscroll/jquery.slimscroll.min.js"></script>
    <script src="assets/vendor/jquery.easy-pie-chart/jquery.easypiechart.min.js"></script>
    <script src="assets/vendor/chartist/js/chartist.min.js"></script>
    <script src="assets/scripts/klorofil-common.js"></script>
    <script>

        $("#alter").click(function(){

            $("#alter").hide();
            $("#alterConfirm").show();
            $("#intro").removeAttr("readonly");

        });
        // 活动
        // 删除活动
        <%
        for (int i=0;i<activities.size();i++){
        %>

        $("#activityDel<%=i%>").mouseover(function(){

            $("#activityDel<%=i%>").css("color","#3287B2");

            $("#tr-activityDel<%=i%>").show();
        });

        // 取消删除活动

        $("#activityDel-cancel<%=i%>").mouseover(function(){

            $("#activityDel<%=i%>").css("color","#00AAFF");
            $("#tr-activityDel<%=i%>").hide();
        });
        <%
                }
        %>


        // 留言
        // 删除留言

        <%
        for (int i=0;i<remarks.size();i++) {
        %>

        $("#messageDel<%=i%>").mouseover(function(){

            $("#messageDel<%=i%>").css("color","#3287B2");

            $("#tr-messageDel<%=i%>").show();
        });

        // 取消删除留言

        $("#messageDel-cancel<%=i%>").mouseover(function(){

            $("#messageDel<%=i%>").css("color","#00AAFF");
            $("#tr-messageDel<%=i%>").hide();
        });

        <%
        }
        %>


        // 对管理员的操作
        // 社长交接

        <%
        for (int i=0;i<users.size();i++) {
        %>

        $("#grant<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#remove<%=i%>").css("color","#00AAFF");
            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#grant<%=i%>").css("color","#006600");
            $("#manage<%=i%>").css("color","#41B314");
            $("#agree<%=i%>").css("color","#41B314");

            $("#tr-remove<%=i%>").hide();
            $("#tr-manage<%=i%>").hide();

            $("#tr-refuse<%=i%>").hide();
            $("#tr-agree<%=i%>").hide();

            $("#tr-revoke<%=i%>").hide();
            $("#tr-grant<%=i%>").show();

        });

        // 取消社长交接

        $("#grant-cancel<%=i%>").mouseover(function(){

            $("#grant<%=i%>").css("color","#41B314");
            $("#tr-grant<%=i%>").hide();
            $("#tr-revoke<%=i%>").hide();
        });

        // 收回管理员

        $("#revoke<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#3287B2");
            $("#remove<%=i%>").css("color","#00AAFF");
            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#grant<%=i%>").css("color","#41B314");
            $("#manage<%=i%>").css("color","#41B314");
            $("#agree<%=i%>").css("color","#41B314");

            $("#tr-remove<%=i%>").hide();
            $("#tr-manage<%=i%>").hide();

            $("#tr-refuse<%=i%>").hide();
            $("#tr-agree<%=i%>").hide();

            $("#tr-grant<%=i%>").hide();
            $("#tr-revoke<%=i%>").show();
        });

        // 取消收回管理员

        $("#revoke-cancel<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#tr-grant<%=i%>").hide();
            $("#tr-revoke<%=i%>").hide();
        });
        <%
        }
        %>


        // 对普通成员的操作
        // 授予管理员权限

        <%
        for (int i=0;i<users.size();i++) {
        %>
        $("#manage<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#remove<%=i%>").css("color","#00AAFF");
            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#grant<%=i%>").css("color","#41B314");
            $("#manage<%=i%>").css("color","#006600");
            $("#agree<%=i%>").css("color","#41B314");

            $("#tr-revoke<%=i%>").hide();
            $("#tr-grant<%=i%>").hide();

            $("#tr-refuse<%=i%>").hide();
            $("#tr-agree<%=i%>").hide();

            $("#tr-remove<%=i%>").hide();
            $("#tr-manage<%=i%>").show();
        });

        // 取消授予管理员

        $("#manage-cancel<%=i%>").mouseover(function(){

            $("#manage<%=i%>").css("color","#41B314");
            $("#tr-manage<%=i%>").hide();
            $("#tr-remove<%=i%>").hide();
        });

        // 成员移出社团

        $("#remove<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#remove<%=i%>").css("color","#3287B2");
            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#grant<%=i%>").css("color","#41B314");
            $("#manage<%=i%>").css("color","#41B314");
            $("#agree<%=i%>").css("color","#41B314");

            $("#tr-revoke<%=i%>").hide();
            $("#tr-grant<%=i%>").hide();

            $("#tr-refuse<%=i%>").hide();
            $("#tr-agree<%=i%>").hide();

            $("#tr-manage<%=i%>").hide();
            $("#tr-remove<%=i%>").show();
        });

        // 取消移出社员

        $("#remove-cancel<%=i%>").mouseover(function(){

            $("#remove<%=i%>").css("color","#00AAFF");
            $("#tr-manage<%=i%>").hide();
            $("#tr-remove<%=i%>").hide();
        });
        <%
        }
        %>

        // 对申请人的操作
        // 同意申请

        <%
        for (int i=0;i<users.size();i++) {
        %>
        $("#agree<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#remove<%=i%>").css("color","#00AAFF");
            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#grant<%=i%>").css("color","#41B314");
            $("#manage<%=i%>").css("color","#41B314");
            $("#agree<%=i%>").css("color","#006600");

            $("#tr-revoke<%=i%>").hide();
            $("#tr-grant<%=i%>").hide();

            $("#tr-remove<%=i%>").hide();
            $("#tr-manage<%=i%>").hide();

            $("#tr-refuse<%=i%>").hide();
            $("#tr-agree<%=i%>").show();
        });

        // 取消同意申请

        $("#agree-cancel<%=i%>").mouseover(function(){

            $("#agree<%=i%>").css("color","#41B314");
            $("#tr-agree<%=i%>").hide();
            $("#tr-refuse<%=i%>").hide();
        });

        // 拒绝申请

        $("#refuse<%=i%>").mouseover(function(){

            $("#revoke<%=i%>").css("color","#00AAFF");
            $("#remove<%=i%>").css("color","#00AAFF");
            $("#refuse<%=i%>").css("color","#3287B2");
            $("#grant<%=i%>").css("color","#41B314");
            $("#manage<%=i%>").css("color","#41B314");
            $("#agree<%=i%>").css("color","#41B314");

            $("#tr-revoke<%=i%>").hide();
            $("#tr-grant<%=i%>").hide();

            $("#tr-remove<%=i%>").hide();
            $("#tr-manage<%=i%>").hide();

            $("#tr-agree<%=i%>").hide();
            $("#tr-refuse<%=i%>").show();
        });

        // 取消拒绝申请

        $("#refuse-cancel<%=i%>").mouseover(function(){

            $("#refuse<%=i%>").css("color","#00AAFF");
            $("#tr-agree<%=i%>").hide();
            $("#tr-refuse<%=i%>").hide();
        });
        <%
        }
        %>
        $(function() {
            var data, options;

            // headline charts
            data = {
                labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                series: [
                    [23, 29, 24, 40, 25, 24, 35],
                    [14, 25, 18, 34, 29, 38, 44],
                ]
            };

            options = {
                height: 300,
                showArea: true,
                showLine: false,
                showPoint: false,
                fullWidth: true,
                axisX: {
                    showGrid: false
                },
                lineSmooth: false,
            };

            new Chartist.Line('#headline-chart', data, options);


            // visits trend charts
            data = {
                labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                series: [{
                    name: 'series-real',
                    data: [200, 380, 350, 320, 410, 450, 570, 400, 555, 620, 750, 900],
                }, {
                    name: 'series-projection',
                    data: [240, 350, 360, 380, 400, 450, 480, 523, 555, 600, 700, 800],
                }]
            };

            options = {
                fullWidth: true,
                lineSmooth: false,
                height: "270px",
                low: 0,
                high: 'auto',
                series: {
                    'series-projection': {
                        showArea: true,
                        showPoint: false,
                        showLine: false
                    },
                },
                axisX: {
                    showGrid: false,

                },
                axisY: {
                    showGrid: false,
                    onlyInteger: true,
                    offset: 0,
                },
                chartPadding: {
                    left: 20,
                    right: 20
                }
            };

            new Chartist.Line('#visits-trends-chart', data, options);


            // visits chart
            data = {
                labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                series: [
                    [6384, 6342, 5437, 2764, 3958, 5068, 7654]
                ]
            };

            options = {
                height: 300,
                axisX: {
                    showGrid: false
                },
            };

            new Chartist.Bar('#visits-chart', data, options);


            // real-time pie chart
            var sysLoad = $('#system-load').easyPieChart({
                size: 130,
                barColor: function(percent) {
                    return "rgb(" + Math.round(200 * percent / 100) + ", " + Math.round(200 * (1.1 - percent / 100)) + ", 0)";
                },
                trackColor: 'rgba(245, 245, 245, 0.8)',
                scaleColor: false,
                lineWidth: 5,
                lineCap: "square",
                animate: 800
            });

            var updateInterval = 3000; // in milliseconds

            setInterval(function() {
                var randomVal;
                randomVal = getRandomInt(0, 100);

                sysLoad.data('easyPieChart').update(randomVal);
                sysLoad.find('.percent').text(randomVal);
            }, updateInterval);

            function getRandomInt(min, max) {
                return Math.floor(Math.random() * (max - min + 1)) + min;
            }

        });
    </script>
    <script>
        //标记1条已读
        function setNoticeReaded(noticeId, mNum, btn) {
            $("#" + noticeId).slideUp();
            event.stopPropagation();
            document.getElementById("NoticeCount").innerText-=1;

            $.ajax({
                url:"MessageServlet?mNum="+mNum+"&btn="+btn,
                type:"POST",
                success:function(e){

                }
            });
        }

        //全部标记为已读
        function setAllNoticeReaded(btn, stuNum){
            $.ajax({
                url:"MessageServlet?btn="+btn+"&stuNum="+stuNum,
                type:"POST",
                success:function(e){
                    location.reload();
                }
            });
        }
        //下拉框查询组件点击区域不关闭下拉框
        //              $("body").on('click','[data-stopPropagation]',function (e) {
        //              e.stopPropagation();
        //  });
        $('.dropdown-menu').on('click', '[data-stopPropagation]', function(e) {
            e.stopPropagation();
        });

    </script>
</body>

</html>

